﻿Imports System.Data.SqlClient
Public Class Conexion

    Public stringConexion As New SqlConnection
    Public Function Conectado()
        Try
            stringConexion = New SqlConnection("Data Source=BONICHEGPR-PC;Initial Catalog=Banco;Integrated Security=True")
            stringConexion.Open()
            Return True
        Catch ex As Exception
            MsgBox("Error al conectar a la Base de Datos")
            Return False
        End Try
    End Function

    Public Function Desconectado()
        Try
            If stringConexion.State = ConnectionState.Open Then
                stringConexion.Close()
                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            MsgBox("Error al conectar a la Base de Datos")
            Return False
        End Try
        Return False
    End Function


End Class
